//
//  WeexImageDownloader.m
//  Shelves
//
//  Created by mac on 2017/11/1.
//  Copyright © 2017年 上海LOL信息科技有限公司. All rights reserved.
//

#import "WeexImageDownloader.h"
#import <SDWebImage/SDWebImageManager.h>

@interface WeexImageDownloader()

@end


@implementation WeexImageDownloader

-(id<WXImageOperationProtocol>)downloadImageWithURL:(NSString *)url imageFrame:(CGRect)imageFrame userInfo:(NSDictionary *)options completed:(void (^)(UIImage *image, NSError *error, BOOL finished))completedBlock{
//    if ([url hasPrefix:@"//"]) {
//        url = [@"http:" stringByAppendingString:url];
//    }
    return (id<WXImageOperationProtocol>)[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:url] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
        
    } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
        if (completedBlock) {
            completedBlock(image, error, finished);
        }
    }];
}

@end
